package com.lecyon.farm.common.enums;

import com.lecyon.farm.util.StringHelper;
import lombok.Getter;

/**
 * 员工状态枚举类型
 *
 * @author Yao Zheng
 * @Date 2019/10/6 14:39
 */
public enum StaffStatusEnum {


    //在职
    ACTIVE("active", "在职"),
    //试用
    TRIALS("trials", "试用"),
    //离职
    LEAVE("leave", "离职"),
    //存档
    ARCHIVES("archives", "存档");

    @Getter
    private String statusValue;

    @Getter
    private String statusCode;

    StaffStatusEnum(String statusCode, String statusValue) {
        this.statusCode = statusCode;
        this.statusValue = statusValue;
    }

    /**
     * 根据状态值获取状态代码
     *
     * @param statusCode 状态值
     * @return 状态
     */
    public static StaffStatusEnum getByValue(String statusCode) {
        if (StringHelper.isNotEmpty(statusCode)) {
            for (StaffStatusEnum staffStatusEnum : values()) {
                if (staffStatusEnum.statusCode.equals(statusCode)) {
                    return staffStatusEnum;
                }
            }
        }
        return null;
    }

}
